// 执行命令  ts-node unionType.ts
// 联合类型
let myFavoriteNumber: string | number;
myFavoriteNumber = 'seven'; // OK
myFavoriteNumber = 7; // OK
const sayHello = (name: string | undefined) => {
  /* ... */
}
sayHello('semlinker')
sayHello(undefined)
let numUN: 1 | 2 = 1;
type EventNames = 'click' | 'scroll' | 'mousemove';


// 类型别名
type Message = string | string[]
let great = (message: Message) => {

}


// 交叉类型
type Useless = string & number // never
type IntersectionType = { id: number; name: string; } & { age: number };
const mixed: IntersectionType = {
  id: 1,
  name: 'name',
  age: 18
}



console.log('unionType: ', arr4)